package com.lanxiao.cloud.common.mybatis.query;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import java.util.function.Function;

/**
 * @author ：qiaoliang
 * @date ：2021-09-14
 */
public class QueryWrapper<T> {

  protected LambdaQueryWrapper<T> queryWrapper = null;

  public QueryWrapper() {
    this.queryWrapper = new LambdaQueryWrapper<>();
  }

  @SafeVarargs
  public final QueryWrapper<T> orderByDesc(SFunction<T, ?>... functions) {
    queryWrapper.orderByDesc(functions);
    return this;
  }

  @SafeVarargs
  public final QueryWrapper<T> orderByAsc(SFunction<T, ?>... functions) {
    queryWrapper.orderByAsc(functions);
    return this;
  }

  public LambdaQueryWrapper<T> query(){
    return this.queryWrapper;
  }

}
